import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { AnnuityRoutingModule } from './annuity-routing.module';
import { AnnuityCheckComponent } from './check/check.component';
import { AnnuityEditComponent } from './edit/edit.component';
import { AnnuityDetailComponent } from './detail/detail.component';
import { EnclosureComponent } from './enclosure/enclosure.component';
import { CostComponent } from './modal/cost/cost.component';
import { BankrollComponent } from './modal/bankroll/bankroll.component';
import { CheckComponent } from './modal/check/check.component';
import { ServiceComponent } from './modal/service/service.component';
import { InvestComponent } from './modal/invest/invest.component';
import { InfoComponent } from './modal/info/info.component';
import { FormsModule } from '@angular/forms';
import * as flatpickr from 'flatpickr';
import { FlatpickrModule, FLATPICKR } from '../../../assets/angularx-flatpickr';
import { AppPaginationModule } from '../../widgets/pagination/pagination.module';
import { AreaDataCnModule } from "../../widgets/area-data-cn/area-data-cn.module";
import { FileUploadModule } from 'ng2-file-upload';
import { CustomFormsModule } from 'ng2-validation';
import { RenewComponent } from './modal/renew/renew.component';
import { ScaleComponent } from './modal/scale/scale.component';
import { ServiceQueryComponent } from './service-query/service-query.component';

export function flatpickrFactory() {
  return flatpickr;
}

@NgModule({
  imports: [
    CommonModule,
    AnnuityRoutingModule,
    AppPaginationModule,
    FormsModule,
    FileUploadModule,
    AreaDataCnModule,
    CustomFormsModule,
    FlatpickrModule.forRoot({
      provide: FLATPICKR,
      useFactory: flatpickrFactory
    })
  ],
  declarations: [
    AnnuityCheckComponent,
    AnnuityEditComponent,
    AnnuityDetailComponent,
    EnclosureComponent,
    CostComponent,
    BankrollComponent,
    CheckComponent,
    ServiceComponent,
    InvestComponent,
    InfoComponent,
    RenewComponent,
    ScaleComponent,
    ServiceQueryComponent
  ],
  entryComponents: [
    CostComponent,
    BankrollComponent,
    CheckComponent,
    ServiceComponent,
    InvestComponent,
    InfoComponent,
    RenewComponent,
    ScaleComponent
  ],
})
export class AnnuityModule { }
